package com.itheima.d4_enum;

public class Student {
    private String name;
    private int age;
    private Sex sex;

    // 构造函数
    public Student(String name, int age, Sex sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    // 获取姓名
    public String getName() {
        return name;
    }

    // 设置姓名
    public void setName(String name) {
        this.name = name;
    }

    // 获取年龄
    public int getAge() {
        return age;
    }

    // 设置年龄
    public void setAge(int age) {
        this.age = age;
    }

    // 获取性别
    public Sex getSex() {
        return sex;
    }

    // 设置性别
    public void setSex(Sex sex) {
        this.sex = sex;
    }

    // 重写toString方法，方便输出学生信息
    @Override
    public String toString() {
        return "姓名：" + name + "，年龄：" + age + "，性别：" + sex.getDesc();
    }
}
